<%@page import="beautiful.butterfly.distributed_task_processing_engine.task_manage.DistributedTaskProcessingEngine" %>
<%@page import="beautiful.butterfly.distributed_task_processing_engine.zookeeper.keys" %>
<%@page import="java.util.Properties" %>
<%@ page contentType="text/html; charset=GB2312" %>
<%

    Properties properties = new Properties();
    properties.setProperty(keys.zooKeeperConnectString.toString(), request.getParameter(keys.zooKeeperConnectString.toString()));
    properties.setProperty(keys.rootPath.toString(), request.getParameter(keys.rootPath.toString()));
    properties.setProperty(keys.userName.toString(), request.getParameter(keys.userName.toString()));
    properties.setProperty(keys.password.toString(), request.getParameter(keys.password.toString()));
    properties.setProperty(keys.zooKeeperSessionTimeout.toString(), request.getParameter(keys.zooKeeperSessionTimeout.toString()));
    try
    {
        DistributedTaskProcessingEngine.saveConfigInfo(properties);
    } catch (Exception e)
    {
        e.printStackTrace();
        response.sendRedirect("config.jsp?error=" + e.getMessage());
    }
%>
<script>
    if (parent != null) {
        parent.location.href = "index.jsp?manager=true";
    } else {
        window.location.href = "index.jsp?manager=true";
    }
</script>
